package com.tangding.service.dao.role;

import java.io.Serializable;
import java.util.List;

import org.bson.conversions.Bson;
import org.springframework.stereotype.Repository;

import com.mongodb.client.model.Filters;
import com.tangding.common.exception.GException;
import com.tangding.service.db.BaseMongoRepository;
import com.tangding.service.db.MongoDBOption;
import com.tangding.service.entity.role.Role;

/**
 * @description 
 *
 * @author Ranger
 * @version 2017年11月9日_上午10:05:37
 *
 */
@Repository
public class RoleRepository extends BaseMongoRepository<Role, Serializable> {

	@Override
	protected void init() {
		option = new MongoDBOption("ACCOUNT", "role");
	}
	
	public List<Role> findRolesByIds(List<Integer> roleIds) throws GException {
		Bson condition = Filters.in("roleId", roleIds);
		List<Role> roles = findAll(condition);
		return roles;
	}
}
